<template>
  <div class="myBox">
    <div class="L"><img :src="LoginUser.avatar" style="object-fit: cover" /></div>
    <div class="C">
      <div class="tit">{{ LoginUser.nickname }}</div>
      <div class="sub">{{ LoginUser.createtime }}</div>
    </div>
    <div class="R"><img src="/assets/images/go.png" /></div>
  </div>
  <div class="clear"></div>
  <div class="allkbox"></div>
  <div class="myboxcon">
    <router-link to="/business/base/profile">
      <p>基本资料</p>
      <img src="/assets/images/go.png" />
    </router-link>
  </div>
  <div class="myboxcon" @click="toMailbox" v-if="LoginUser.auth == 0">
    <p>邮箱认证</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon">
    <router-link to="/business/address/index">
      <p>收货地址</p>
      <img src="/assets/images/go.png" />
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link to="/business/order/index">
      <p>我的订单</p>
      <img src="/assets/images/go.png" />
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link to="/business/base/record">
      <p>消费记录</p>
      <img src="/assets/images/go.png" />
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link to="/business/base/deposit">
      <p>充值中心</p>
      <img src="/assets/images/go.png" />
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link to="/business/base/rechargerecord">
      <p>充值记录</p>
      <img src="/assets/images/go.png" />
    </router-link>
  </div>
  <div class="myboxcon" @click="logout">
    <p>退出登陆</p>
    <img src="/assets/images/go.png" />
  </div>

  <div class="clear"></div>
  <div class="h54"></div>
  <div class="clear"></div>
  <Footer />
</template>
<script setup>
import Footer from "@/components/common/footer.vue";
const { cookies } = useCookies();
const router = useRouter();
const LoginUser = ref(cookies.get("LoginUser"));
const logout = () => {
  showConfirmDialog({
    title: "退出",
    message: "确认是否退出登陆？",
  })
    .then(() => {
      //删除存储的用户信息
      cookies.remove("LoginUser");
      router.push("/business/base/login");
    })
    .catch(() => {});
};
const toMailbox = () => {
  if (LoginUser.auth == "1") {
    showNotify({ type: "warning", message: "邮箱已认证" });
  } else {
    router.push("/business/base/mailbox");
  }
};
</script>
